//
//  HomeViewController.m
//  LLP
//
//  Created by Porcellio on 10/9/12.
//  Copyright (c) 2012 Porcellio. All rights reserved.
//

#import "HomeViewController.h"

#import "CaptureViewController.h"
#import "SettingViewController.h"
#import "AboutViewController.h"
#import "LibraryViewController.h"

@interface HomeViewController (Private)

- (void)btnCaptureDidPressed;
- (void)btnLibraryDidPressed;
- (void)btnSettingDidPressed;
- (void)btnAboutDidPressed;

@end

@implementation HomeViewController


- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    
    // Create Buttons.
    _btnCapture = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    _btnCapture.frame = CGRectMake(60.0f, 40.0f, 200.0f, 40.0f);
    [_btnCapture setTitle:@"拍摄" forState:UIControlStateNormal];
    [_btnCapture addTarget:self action:@selector(btnCaptureDidPressed) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_btnCapture];
    
    _btnLibrary = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    _btnLibrary.frame = CGRectMake(60.0f, 100.0f, 200.0f, 40.0f);
    [_btnLibrary setTitle:@"媒体库" forState:UIControlStateNormal];
    [_btnLibrary addTarget:self action:@selector(btnLibraryDidPressed) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_btnLibrary];
    
    _btnSetting = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    _btnSetting.frame = CGRectMake(60.0f, 160.0f, 200.0f, 40.0f);
    [_btnSetting setTitle:@"设置" forState:UIControlStateNormal];
    [_btnSetting addTarget:self action:@selector(btnSettingDidPressed) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_btnSetting];
    
    _btnAbout = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    _btnAbout.frame = CGRectMake(60.0f, 220.0f, 200.0f, 40.0f);
    [_btnAbout setTitle:@"关于" forState:UIControlStateNormal];
    [_btnAbout addTarget:self action:@selector(btnAboutDidPressed) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_btnAbout];
    
}


#pragma mark -
#pragma mark Private Methods.

- (void)btnCaptureDidPressed {

    CaptureViewController *captureViewCtrl = [[CaptureViewController alloc] init];
    [self.navigationController pushViewController:captureViewCtrl animated:YES];
    [captureViewCtrl release];
}

- (void)btnLibraryDidPressed {
    LibraryViewController* newPage = [[LibraryViewController alloc]init];
    [self.navigationController pushViewController:newPage animated:YES];
    [newPage release];
}

- (void)btnSettingDidPressed {
    SettingViewController* newPage = [[SettingViewController alloc]init];
    [self.navigationController pushViewController:newPage animated:YES];
    [newPage release];
}

- (void)btnAboutDidPressed {
    AboutViewController* newPage = [[AboutViewController alloc]init];
    [self.navigationController pushViewController:newPage animated:YES];
    [newPage release];
}

@end
